#!/bin/bash

TIME_BIN="/usr/bin/time"
HW1_DIR="/homes/a/abbasmus/courses/454ece/hw1"

pushd $HW1_DIR

for executable in *.exe; do
    echo "$executable" ""
    
    for ((i=0; i<5; i++)); do
        $TIME_BIN $executable iir1.map4.latren.net k4-n10.xml place.out route.out -nodisp -place_only -seed 0 > /dev/null
    done 2>&1 |
    grep user |
    awk '{print $1}' | sed 's,user,,' | awk '{sum += $1} END {print sum/5}'

done

popd
